﻿Public Class frmARSalesOrderList
    Dim dbBase As New dbSales
    Dim frmCtrl As New FormControl
    Dim Var As New varDeclare
    Dim dsBase As DataSet
    Dim EntryID As String

    Private Sub frmARSalesOrder_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        EntryID = ""
        GridAndFind1.Enabled = True
        dsBase = dbBase.GetBaseList()
        ToolbarHeader1.Iniliaze("LIST : Sales Order", Me, Nothing, GridAndFind1.getDataGridView(), "Number")
        GridAndFind1.Initialize(dsBase, "Number", ToolbarHeader1, Me, True)
        ToolbarHeader1.ActionCtrl(True, True, False, False, False, False, False, True, True)
    End Sub

    Private Sub tsNew_Click(ByVal sender As Object) Handles ToolbarHeader1.tsNewClick
        Dim OpenForm As New frmARSalesOrderEntry
        OpenForm.EntryID = ""
        frmCtrl.OpenFormDetail(Me, OpenForm)
    End Sub

    Private Sub GridCellEnter_Click(ByVal sender As GridAndFind, KeyValue As String) Handles GridAndFind1.GridCellEnter
        Dim dvFind As DataView = New DataView(dsBase.Tables(0))
        dvFind.RowFilter = "[Number] = '" & KeyValue & "'"
        EntryID = dvFind.Item(0).Row("Number").ToString()
    End Sub

    Private Sub tsView_Click(ByVal sender As Object) Handles ToolbarHeader1.tsViewClick
        Dim OpenForm As New frmARSalesOrderEntry
        OpenForm.EntryID = EntryID
        frmCtrl.OpenFormDetail(Me, OpenForm)
    End Sub

    Private Sub tsRefresh_Click(ByVal sender As Object) Handles ToolbarHeader1.tsRefreshClick
        frmCtrl.openChild(New frmARSalesOrderList, Me.ParentForm)
    End Sub
End Class